package server;

/**
 * 相应状态码的头部信息
 */
public class HttpProtocolUtil {

    /**
     * 状态200的 响应头信息
     * @return
     */
    public static String getHttpHead200(long length){
        String str200 = "HTTP/1.1 200 OK \n"
                + "Content-Type: text/html \n"
                + "Content-Length: " + length + "\n"
                + "\r\n";
        return str200;
    }

    /**
     * 状态404的 响应头信息
     * @return
     */
    public static String getHttpHead404(){
        String s404 = "<h1>404 not found</h1>";

        String str404 = "HTTP/1.1 404 NOT Found \n"
                + "Content-Type: text/html \n"
                + "Content-Length: " + s404.getBytes().length + "\n"
                + "\r\n"
                + s404;
        return str404;
    }

}
